<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const arr = ['1', 3, 55, 6, 7, 88999, 11, '1', 1]
        // const arr1 = ['1', 3, 55, 6, 7, 88999, 11, 55, '1', 1]
        // new Set()方法
        const setArr = new Set(arr)
        console.log(setArr)
        // findIndex方法
        // console.log(arr)
        const arr2 = JSON.parse(JSON.stringify(arr))
        const k = []
        const s = arr2.findIndex((x) => {
            let flag = true
            if (k.indexOf(x) === -1) {
                k.push(x)
                flag = false
            }
            return flag
        })
        // console.log(s)
        arr2.splice(s, 1)
        console.log(arr2)
        // filter方法
        const newArr = arr.filter((item, index, arr) => {
            return arr.indexOf(item) === index
        })
        console.log(newArr)
        // forEach方法
        let arr1 = []
        arr.forEach((item) => {
            // console.log(item);
            // console.log(arr1.indexOf(item));
            if (arr1.indexOf(item) === -1) {
                arr1.push(item)
            }
        })
        console.log(arr1)
    </script>
</body>

</html>